package net.lab1024.sa.base.module.support.changelog.controller;

import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import net.lab1024.sa.base.common.controller.SupportBaseController;
import net.lab1024.sa.base.common.domain.PageResult;
import net.lab1024.sa.base.common.domain.R;
import net.lab1024.sa.base.module.support.changelog.domain.form.ChangeLogQueryForm;
import net.lab1024.sa.base.module.support.changelog.domain.vo.ChangeLogVO;
import net.lab1024.sa.base.module.support.changelog.service.ChangeLogService;
import org.springframework.web.bind.annotation.*;

/**
 * 系统更新日志 Controller
 *
 * @Author 卓大
 * @Date 2022-09-26 14:53:50
 * @Copyright 1024创新实验室
 */

@RestController
// API接口分组
public class ChangeLogController extends SupportBaseController {

    @Resource
    private ChangeLogService changeLogService;

    // 分页查询 @author 卓大
    @PostMapping("/changeLog/queryPage")
    public R<PageResult<ChangeLogVO>> queryPage(@RequestBody @Valid ChangeLogQueryForm queryForm) {
        return R.ok(changeLogService.queryPage(queryForm));
    }

    // 变更内容详情 @author 卓大
    @GetMapping("/changeLog/getDetail/{changeLogId}")
    public R<ChangeLogVO> getDetail(@PathVariable Long changeLogId) {
        return R.ok(changeLogService.getById(changeLogId));
    }
}